<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@page import="java.util.Collection" %>
<%@page import="java.util.Iterator" %>
<%@page import="com.liuya.safe.model.SafePrivilege" %>
<%@ include file="../common/taglib.jsp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


<%@page import="com.liuya.common.StringUtil" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link rel="shortcut icon" href="${contextPath}/style/def/favicon.ico">
    <%@ include file="../common/static.jsp" %>
    <link type="text/css" rel="stylesheet" href="${contextPath}/style/def/css/syntaxhighlighter/shCoreDefault.css"/>

    <script type="text/javascript" src="${contextPath}/style/def/js/syntaxhighlighter/shCore.js"></script>
    <script type="text/javascript" src="${contextPath}/style/def/js/syntaxhighlighter/shBrushJava.js"></script>

        <%
I18N i18n=I18N.getInstance();
%>

    <title><%=i18n.say("Privilege_Constants")%>
    </title>
<body>
<jsp:include page="../common/header.jsp"></jsp:include>
<%@include file="../common/menu.jsp" %>

<%
    Collection businessPrivileges = (Collection) request.getAttribute("businessPrivileges");
    Collection nonRolePrivileges = (Collection) request.getAttribute("nonRolePrivileges");
%>

<div class="smallContainer">
    <label><%=i18n.say("Export_privilege_constants")%>
    </label>
    <pre class="brush: java;">
//------------ COPY THESE CODE TO YOUR CONSTANTS CLASS --
//------------ business privilege constants -------------
<%
    for (Iterator iter = businessPrivileges.iterator(); iter.hasNext(); ) {
        SafePrivilege pvlg = (SafePrivilege) iter.next();
        if (pvlg.getIsLeaf()) {
%>
	<% if (!StringUtil.isEmpty(pvlg.getDescription())) { %>
/**
  * <%=pvlg.getDescription() %>
  */ 	<% } %>
public static final int <%=pvlg.getConstantName()%>=<%=pvlg.getId() %>;
<% }
}%>

//------------ non role privilege constants -------------
<%
    for (Iterator iter = nonRolePrivileges.iterator(); iter.hasNext(); ) {
        SafePrivilege pvlg = (SafePrivilege) iter.next();
        if (pvlg.getIsLeaf()) {
%>
	<% if (!StringUtil.isEmpty(pvlg.getDescription())) { %>
/**
  * <%=pvlg.getDescription() %>
  */<% } %>
public static final int <%=pvlg.getConstantName()%>=<%=pvlg.getId() %>;
<% }
}%>
</pre>
</div>


<jsp:include page="../common/footer.jsp"></jsp:include>

<script>
    jQuery(document).ready(function () {
        SyntaxHighlighter.all();
    });
</script>
</body>
</html>